package demo8;

public class Test {
    public static void go(Swimming s){
        System.out.println("游泳开始！");
        s.swim();
    }
    public static void main(String[] args) {
        Swimming s1 = new Swimming(){
            @Override
            public void swim (){
                System.out.println("狗游的飞快~");
            }
        };
        Swimming s2 = new Swimming() {
            @Override
            public void swim() {
                System.out.println("猫不会游泳~");
            }
        };
        go(s1);
        go(s2);

    }

}
